package chenji.yourticket.inventory;

import java.util.ArrayList;

import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

/**
 * @author ChenJi Copyright (c) 2016 ChenJi. All rights reserved.
 */
public class SimpleItemStack extends ItemStack {
	public SimpleItemStack(Material m, String[] lore, String Title) {
		super(m);
		ArrayList<String> lr = new ArrayList<String>();
		for (final String line : lore) {
			lr.add(line);
		}
		ItemMeta meta = this.getItemMeta();

		meta.setDisplayName(Title);
		meta.setLore(lr);
		this.setItemMeta(meta);
	}

	public SimpleItemStack(Material m, String[] lore, String Title, int data) {
		super(m, 1, (short) data);
		ArrayList<String> lr = new ArrayList<String>();
		for (final String line : lore) {
			lr.add(line);
		}
		ItemMeta meta = this.getItemMeta();

		meta.setDisplayName(Title);
		meta.setLore(lr);
		this.setItemMeta(meta);
	}

	public SimpleItemStack(Material m, String loreinoneline, String Title) {
		super(m);
		ItemMeta meta = this.getItemMeta();
		if (!(loreinoneline == null)) {
			String[] lore = loreinoneline.split("#");
			ArrayList<String> lr = new ArrayList<String>();
			for (final String line : lore) {
				lr.add(line);
			}
			meta.setLore(lr);
		}
		meta.setDisplayName(Title);
		this.setItemMeta(meta);
	}

	public SimpleItemStack(Material m, String loreinoneline, String Title, int data) {
		super(m, 1, (short) data);
		ItemMeta meta = this.getItemMeta();
		if (!(loreinoneline == null)) {
			String[] lore = loreinoneline.split("#");
			ArrayList<String> lr = new ArrayList<String>();
			for (final String line : lore) {
				lr.add(line);
			}
			meta.setLore(lr);
		}
		meta.setDisplayName(Title);
		this.setItemMeta(meta);
	}

}
